<?php
//服务器和数据库信息
$servername = "localhost";
$username = "root";
$password = "";
$dbName = "myDB";
$tableName = "myguest";


// 创建连接
$conn = new mysqli($servername, $username, $password, $dbName);
 
// 检测连接
if ($conn->connect_error) {
  die("连接失败: " . $conn->connect_error);
}



$sql = "SELECT COLUMN_NAME FROM information_schema.COLUMNS where TABLE_NAME = 'myguest' and TABLE_SCHEMA = '$dbName' and TABLE_CATALOG ='def'" ;
$result = $conn->query($sql);
if ($result->num_rows>0) {
  
  $row = $result->fetch_all();
    // var_dump($row);
  foreach ($row as $key => $value) {
    echo($value[0]);
    echo("<br/>");
  }
  
}
// echo();
// echo($result . "22222");
?>